const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
    lintOnSave: false,
    css: {
        loaderOptions: {
            // postcss: {
            // 	plugins: [require('px2rem-loader')({
            // 		remUnit: 75
            // 	})]
            // },
            css: {
                importLoaders: 10,
            },
        },
    },
    configureWebpack: (config) => {
        config.plugins.forEach((val) => {
            if (val instanceof HtmlWebpackPlugin) {
                val.options.title = "公共环境安全监管云平台"
            }
        })
        config.externals = { AMap: "AMap" }
    },
    chainWebpack: (config) => {
        // config.module
        // 	.rule('css')
        // 	.test(/\.css$/)
        // 	.oneOf('vue')
        // 	.resourceQuery(/\?vue/)
        // 	.use('px2rem')
        // 	.loader('px2rem-loader')
        // 	.options({
        // 		remUnit: 192,
        // 		remPrecision: 5
        // 	})
        // 	.end()
        // config.module
        // 	.rule('less')
        // 	.oneOf('vue')
        // 	.use('px2rem-loader')
        // 	.loader('px2rem-loader')
        // 	.before('postcss-loader') // this makes it work.
        // 	.options({
        // 		remUnit: 192,
        // 		remPrecision: 5
        // 	})
        // 	.end()
    },
    productionSourceMap: false,
    publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
    devServer: {
        disableHostCheck: true,
        port: 8080,
        proxy: {
            "/papi": {
                target: "http://101.201.140.249:9093",
                ws: true,
                changeOrigin: true,
                pathRewrite: {
                    "^/papi": "",
                },
            },
        },
    },
}
